using Microsoft.Extensions.Configuration;
using RedisDemo.Redis;

ThreadPool.SetMinThreads(1000, 1000);

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.

builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var config = new CacheConfig();
builder.Configuration.GetSection("CacheConfig").Bind(config);
builder.Services.AddSingleton(config);
builder.Services.AddSingleton<IRedisConnectionWrapper, RedisConnectionWrapper>();
builder.Services.AddSingleton<ICacheManager, RedisCacheManager>();


var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseAuthorization();

app.MapControllers();

app.Run();
